﻿using System;
using System.Runtime.Serialization;

using EpcTagLibrary;

namespace ALE_Server
{
    [DataContract]
    public class TagEvent
    {
        private EPC m_Tag;
        private short m_AntennaPort;
        private string m_LogicalReader;
        private DateTime m_DiscoverTime;
        private DateTime m_RegisterTime;        

        public TagEvent(EPC tag)
        {
            m_Tag = tag;
            m_DiscoverTime = System.DateTime.Now;
        }

        [DataMember]
        public EPC Tag
        {
            get
            {
                return m_Tag;
            }
            set
            {
                m_Tag = value;
            }
        }

        [DataMember]
        public short AntennaPort
        {
            get
            {
                return m_AntennaPort;
            }
            set
            {
                m_AntennaPort = value;
            }
        }

        [DataMember]
        public string LogicalReader
        {
            get
            {
                return m_LogicalReader;
            }
            set
            {
                m_LogicalReader = value;
            }
        }

        [DataMember]
        public DateTime DiscoverTime
        {
            get
            {
                return m_DiscoverTime;
            }
            set
            {
                m_DiscoverTime = value;
            }
        }

        [DataMember]
        public DateTime RegisterTime
        {
            get
            {
                return m_RegisterTime;
            }
            set
            {
                m_RegisterTime = value;
            }
        }

        public override string ToString()
        {
            return XmlSerializeHelper.Serialize(this);
        }
    }
}
